﻿namespace GoodAdmin.Web.Core;

/// <summary>
/// 字典类型管理控制器
/// </summary>
[ApiDescriptionSettings("System", Tag = "字典类型管理")]
[Route("system/dictType")]
public class DictTypeController : IDynamicApiController
{
    private readonly IDictTypeService _dictTypeService;

    public DictTypeController(IDictTypeService dictTypeService)
    {
        _dictTypeService = dictTypeService;
    }

    /// <summary>
    /// 分页查询字典类型
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpGet("page")]
    [DisplayName("分页查询字典类型")]
    public async Task<SqlSugarPagedList<DictTypeSimpleInfo>> Page([FromQuery]DictTypePageInput input)
    {
        return await _dictTypeService.Page(input);
    }

    [HttpGet("list")]
    [DisplayName("获取所有字典类型")]
    public async Task<List<DictTypeSimpleInfo>> GetDictTypeList()
    {
        return await _dictTypeService.GetDictTypeList();
    }
    /// <summary>
    /// 添加字典类型
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost("add")]
    [DisplayName("添加字典类型")]
    public async Task Add(DictTypeAddInput input)
    {
        await _dictTypeService.Add(input);
    }
    /// <summary>
    /// 删除字典类型
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost("delete")]
    [DisplayName("删除字典类型")]
    public async Task Delete(BaseIdInput input)
    {
        await _dictTypeService.Delete(input);
    }
    
    /// <summary>
    /// 更新字典类型
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost("update")]
    [DisplayName("更新字典类型")]
    public async Task Update(DictTypeUpdateInput input)
    {
        await _dictTypeService.Update(input);
    }

}